
function a1(e, p2, id) {
	$.cookie('id_', id);

	p2 = query(p2);
	$.cookie('p2', p2);
	
	var a1 = ['编辑信息', 'url', 'dialog_edit_', '650x400', '编辑信息'];
	var a2 = ['查看信息', 'url', 'dialog_view_', '650x400', '查看信息'];

	var c1 = 'document.php?do=DocumentInfo.edit&id=' + id;
	var c2 = 'document.php?do=DocumentInfo.view&id=' + id;

	var s = c2;

	popup(e, [a2], s);
}

function dialog_edit_(url, title, xy) {
	$.getJSON('document.php?do=DocumentInfo.ajax_emp', function(json) {
		if (json.status == 1) {
			$('#dialog_edit').dialog('option', 'buttons', {

				"关闭": function() {
					$(this).dialog("close");
				},

				"修改": function() {
					if (!confirm("确认是否提交？")) {
						return false;
					}

					var form = $("#form_edit")[0];

					var body = {};
					body.id = form.id.value;
					body.title = form.title.value;
					body.content = form.content.value;

					$(this).dialog("close");

					var url = 'document.php?do=DocumentInfo.editPost';
					var p2 = $.cookie('p2');
					if (p2 != null) {
						url += p2;
					}

					$.post(url, body, function(data) {
						$('#result').html(data);
					});
				}
			});

			dialog_edit(url, title, xy);
	} else {
			_error();
		}
	});
}

function dialog_view_(url, title, xy) {
	$('#dialog_view').dialog('option', 'buttons', {

		"关闭": function() { 
			$(this).dialog("close");
		}
	});

	dialog_view(url, title, xy);
}

function _document(id) {
	var url = "document.php?do=Document.view&id=" + id;
	$('#dialog_view').dialog('option', 'buttons', { 		
		"关闭": function() { 
			$(this).dialog("close");
		}
	});

	dialog_view(url, '文档描述', '650x400');
}
